const beh = require('./beh')

Component({
  /**
   * 组件的属性列表
   */
  behaviors: [beh],

  relations: {
    './child': {
      type: 'child',
      linked(target) {
        console.log(target.data.childtitle)
      }
    }
  },

  properties: {

  },

  /**
   * 组件的初始数据
   */
  data: {
    title: 'hello',
    message: 'abc'
  },

  lifetimes: {
    created() {
      console.log('created.')
      this.page = 100
    },
  
    attached() {
      console.log('attached.')
      // this.setData({
      //   message: 'world'
      // })
    },
  
    ready() {
      console.log('ready')
      this.setData({
        title: this.page
      })
    }
  },

  pageLifetimes: {
    show() {
      console.log('show')
    },
    hide() {
      console.log('hide')
    }
  },

  /**
   * 组件的方法列表
   */
  methods: {
    handleTap() {
      this.setData({
        title: 'hi'
      })
    },

    handleMyEvent(e) {
      this.setData({
        message: e.detail
      })
    }
  }
})
